//
//  SecondViewController.m
//  适配之道
//
//  Created by macbook on 2017/5/24.
//  Copyright © 2017年 oceansoft. All rights reserved.
//

#import "SecondViewController.h"
#import <MediaPlayer/MediaPlayer.h>

@interface SecondViewController (){
    MPMoviePlayerController *_player;
}

@end

@implementation SecondViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self.navigationController.navigationBar setHidden:YES];
    
//    CGRect currentFrame = _mainImageView.frame;
//    
//    currentFrame.size.height = 1/[UIScreen mainScreen].scale;
//    
//    _mainImageView.frame = currentFrame;
    
    _player = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL URLWithString:@"http://172.17.122.209:8089/knowledgefiles/zte/videos/201704/fb48e603941229bff9cba37c881700c0_131122455.mp4"]];
    
    [_player setFullscreen:YES];
//    [player prepareToPlay];
//    [_player.view setFrame: CGRectMake(0,64 , self.view.bounds.size.width, self.view.bounds.size.height/3)];  // player's frame must match parent's
    
    [self.view addSubview: _player.view];
    
    [_player play];
    
    // Do any additional setup after loading the view.
}


-(void)viewWillLayoutSubviews
{
    [_player.view setFrame:self.view.bounds];
//
//    if(self.view.bounds.size.width > self.view.bounds.size.height){
//    }else{
//        [_player.view setFrame: CGRectMake(0,64 , self.view.bounds.size.width, self.view.bounds.size.height/3)];  // player's frame must match parent's
//    }
    
    
    NSLog(@"%@",NSStringFromCGRect(self.view.bounds));
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
